<html>
  <head>
  <title>listcomp.py</title>
  </head>
  <body>
  <h3>listcomp.py</h3>
  <hr>
  <pre>
nums <span style="font-weight: bold">= [</span><span style="color: red">1</span><span style="font-weight: bold">,</span><span style="color: red">2</span><span style="font-weight: bold">,</span><span style="color: red">3</span><span style="font-weight: bold">,</span><span style="color: red">4</span><span style="font-weight: bold">,</span><span style="color: red">5</span><span style="font-weight: bold">,</span><span style="color: red">6</span><span style="font-weight: bold">]
</span>oddNums <span style="font-weight: bold">= [</span>x <span style="color: blue; font-weight: bold">for </span>x <span style="color: blue; font-weight: bold">in </span>nums <span style="color: blue; font-weight: bold">if </span>x <span style="font-weight: bold">% </span><span style="color: red">2 </span><span style="font-weight: bold">== </span><span style="color: red">1</span><span style="font-weight: bold">]
</span><span style="color: blue; font-weight: bold">print </span>oddNums
oddNumsPlusOne <span style="font-weight: bold">= [</span>x<span style="font-weight: bold">+</span><span style="color: red">1 </span><span style="color: blue; font-weight: bold">for </span>x <span style="color: blue; font-weight: bold">in </span>nums <span style="color: blue; font-weight: bold">if </span>x <span style="font-weight: bold">% </span><span style="color: red">2 </span><span style="font-weight: bold">==</span><span style="color: red">1</span><span style="font-weight: bold">]
</span><span style="color: blue; font-weight: bold">print </span>oddNumsPlusOne

  </pre>
  </body>
  </html>
  